import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:screen_capture_event_ohos/screen_capture_event_ohos.dart';

void main() {
  TestWidgetsFlutterBinding.ensureInitialized();

  const MethodChannel('screencapture_method')
      .setMockMethodCallHandler((MethodCall methodCall) async {
    if (methodCall.method == 'request_permission') {
      return true;
    }
    if (methodCall.method == 'prevent_screenshot') {
      return true;
    }
    if (methodCall.method == 'watch') {
      return true;
    }
    if (methodCall.method == 'dispose') {
      return true;
    }
    if (methodCall.method == 'isRecording') {
      return false;
    }
    return null;
  });

  test('prevents ohos screenshots', () async {
    final screenCaptureEventOhos = ScreenCaptureEventOhos();
    await screenCaptureEventOhos.preventOhosScreenShot(true);
  });

  test('checks if screen recording is active', () async {
    final screenCaptureEventOhos = ScreenCaptureEventOhos();
    final bool isRecording = await screenCaptureEventOhos.isRecording();
    expect(isRecording, false);
  });
}
